/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.googlecode.jmicroerp.model;

import java.util.Date;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import java.math.BigDecimal;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;

/**
 *
 * @author Alexandru.Codescu
 */
@SuppressWarnings("serial")
@Entity
@Table(name = "aprovizionare")

@NamedQueries({
    @NamedQuery(
            name = "Aprovizionare.queryByRecipientAll",
            query = "select apm.dataModificarii, apm.cantitate "
            + "from Aprovizionare apm "
            + "where apm.recipient.id = ?1 "
            + "and apm.dataModificarii = ?2 "),
    @NamedQuery(
            name = "Aprovizionare.queryAprovizionare",
            query = "select apm.recipient.denumire, apm.dataModificarii, apm.cantitate, apm.recipient.id, apm.recipient.magazin.id, apm.recipient.stoc.produs.id, apm.utilizator.numeUtilizator "
            + "from Aprovizionare apm "
            //+ "join Utilizatori usr "
            + "where apm.recipient.id = ?1 "
            //+ "and apm.dataCitirii = ?2 "
            + "order by apm.dataModificarii desc")
        
})


public class Aprovizionare extends AbstractEntitate {
	private Recipient recipient;
    private BigDecimal cantitate;
    private Date dataModificarii;
    private Boolean monitorizeaza;
    private Utilizator utilizator;


	@ManyToOne(fetch = FetchType.LAZY, targetEntity = Recipient.class)
	@JoinColumn(name = "RECIPIENT_ID")
	public Recipient getRecipient() {
	    return recipient;
	}
	
	public void setRecipient(Recipient recipient) {
	    this.recipient = recipient;
	}
	
	@Column(name = "CANTITATE")
	public BigDecimal getCantitate() {
	    return cantitate;
	}
	
	public void setCantitate(BigDecimal cantitate) {
	    this.cantitate = cantitate;
	}
	
	@Column(name = "DATA_MODIFICARII")
	@Temporal(TemporalType.TIMESTAMP)
	public Date getdataModificarii() {
	    return dataModificarii;
	}
	
	public void setdataModificarii(Date dataModificarii) {
	    this.dataModificarii = dataModificarii;
	}
	
	@Column(name = "MONITORIZEAZA")
	public Boolean getMonitorizeaza() {
	    return monitorizeaza;
	}
	
	public void setMonitorizeaza(Boolean monitorizeaza) {
	    this.monitorizeaza = monitorizeaza;
	}

	@ManyToOne(fetch = FetchType.LAZY, targetEntity = Utilizator.class)
	@JoinColumn(name = "UTILIZATOR_ID")
	public Utilizator getUtilizator() {
	    return utilizator;
	}
	
	public void setUtilizator(Utilizator utilizator) {
	    this.utilizator = utilizator;
	}
	
}

